function [ label, data, dheader ] = load_data_with_lbl( lblfile, datfile )
%LOAD_DATA_WITH_LBL Summary of this function goes here
%   Detailed explanation goes here

lblfile = strrep(lblfile, '\', '/');
delimiter = find(lblfile == '/', 1, 'last');
if isempty(delimiter)
    filepath = '';
else
    filepath = lblfile(1:(delimiter-1));
end

[label, lblheader] = read_pam_lbl_data(lblfile);

file = [filepath '/' lblheader.MATFile];
if exist('datfile', 'var') && datfile
    file = datfile;
end

load(file, '-mat');
dheader = header;

end

